<script>
function checkform(){
	var subject=$('input[name="en_flname"]').val();
	if(trim(subject)==''){
		alert('请填写分类英文名!');
		return false;		
	}
	
	commonEffection.setLoading();
	$('#addBulletinForm').submit();
}
	upload.type='bulletin';
	upload.formid='addBulletinForm';
	upload.setAppend=function(imgurl){
		return '<div style="margin:10px"><a href="'+imgurl+'" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="'+imgurl+'" /></a> 图片说明:<input type="text" name="imgIntro[]" value="" /><input type="hidden" name="imgUrl[]" value="'+imgurl+'" />　<input type="button" value="插入" onclick="commonEffection.InserImg(\''+imgurl+'\');" />　<input type="button" value="删除" onclick="upload.delimg(this);" /></div>';
}	function move(obj){		if(obj==''){			return;		}		var oList1=document.getElementById("oListbox1");		var oList2=document.getElementById("oListbox2");		var arrOptions=new Array;		if(obj=="add"){			if(oList1.options.length<=0){				alert("左边已经没有了");				return;			}		if(oList1.selectedIndex<0)	{	alert("请选择要删除的项");	return;	}	for(var i=0;i<oList1.options.length;i++)	{	if(oList1.options[i].selected)	{	//将当前选中的添加到数组中	arrOptions.push(oList1.options[i]);	}	}	for(var i=0;i<arrOptions.length;i++)	{	//循环把数组中的值添加的oList2	oList2.appendChild(arrOptions[i]);	}	}	else if(obj=="delete")	{	if(oList2.options.length<=0)	{	alert("右边已经没有了");	return;	}	if(oList2.selectedIndex<0)	{	alert("请选择要删除的项");	return;	}	for(var i=0;i<oList2.options.length;i++)	{	if(oList2.options[i].selected)	{	arrOptions.push(oList2.options[i]);	}	}	for(var i=0;i<arrOptions.length;i++)	{	oList1.appendChild(arrOptions[i]);	}	}	}	function move1(obj){		if(obj==''){			return;		}		var oList1=document.getElementById("bind1");		var oList2=document.getElementById("bind2");		var price =document.getElementById("price");		var arrOptions=new Array;		if(obj=="add"){			if(oList1.options.length<=0){				alert("左边已经没有了");				return;			}		if(oList1.selectedIndex<0){			alert("请选择要删除的项");			return;		}	for(var i=0;i<oList1.options.length;i++)	{	if(oList1.options[i].selected){		//将当前选中的添加到数组中		if(price.value.length<=0){			alert("请填写价格");			return;		}		oList1.options[i].text = oList1.options[i].text +"%%%"+price.value;		oList1.options[i].value = oList1.options[i].value +"%%%"+price.value;		arrOptions.push(oList1.options[i]);	}	}	for(var i=0;i<arrOptions.length;i++){	//循环把数组中的值添加的oList2			oList2.appendChild(arrOptions[i]);	}	}	else if(obj=="delete")	{	if(oList2.options.length<=0)	{	alert("右边已经没有了");	return;	}	if(oList2.selectedIndex<0)	{	alert("请选择要删除的项");	return;	}	for(var i=0;i<oList2.options.length;i++)	{	if(oList2.options[i].selected)	{		oList2.options[i].text = oList2.options[i].text.substring(0,oList2.options[i].text.indexOf("%%%"));		oList2.options[i].value = oList2.options[i].value.substring(0,oList2.options[i].value.indexOf("%%%"));	arrOptions.push(oList2.options[i]);	}	}	for(var i=0;i<arrOptions.length;i++)	{	oList1.appendChild(arrOptions[i]);	}	}	}	function selectAll(){	for(var i=0; i< document.getElementById("oListbox2").options.length; i++)	{	 document.getElementById("oListbox2").options[i].selected=true;	}	for(var j=0; j< document.getElementById("bind2").options.length; j++)	{	 document.getElementById("bind2").options[j].selected=true;	}	}
</script>
<div class="frame_addfactoryDiv">
  <form name="addBulletinForm" id="addBulletinForm" enctype="multipart/form-data"  action="administrator<?=CHOSING_DE?>fenlei<?=CHOSING_DE?>doedit?itemid=<?=$this->oneFenleiArray[0]['flid']?>" method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 分类英文名：</td>
      <td width="85%" class="le">
          <input type="text" name="en_flname" maxlength="30" size="50" value="<?=$this->oneFenleiArray[0]['en_flname']?>" id="en_flname">
	  </td>
    </tr>
     <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 分类中文名：</td>
      <td width="85%" class="le">
	  	<input type="text" name="flname" maxlength="30" size="50" value="<?=$this->oneFenleiArray[0]['flname']?>" id="flname">
	  </td>
    </tr>
    <tr>
      <td class="ri-bbgg">描述：</td>
      <td class="le">
        <div>
            <textarea name="flbody" id="flbody" cols="60" rows="12" style="display:none"><?=$this->oneFenleiArray[0]['flbody']?></textarea><input type="hidden" id="flbody___Config" value="" style="display:none" /><iframe id="flbody___Frame" src="/fckeditor/editor/fckeditor.html?InstanceName=flbody&amp;Toolbar=Default" width="98%" height="400" frameborder="0" scrolling="no"></iframe>
        </div>
	  </td>
    </tr>	<tr>      <td width="15%" class="ri-bbgg"><span class="red">*</span> 关键词：</td>      <td width="85%" class="le">	  	<input type="text" name="fenlei_keywords"  value="<?=$this->oneFenleiArray[0]['fenlei_keywords']?>" id="flname">	  </td>    </tr>        <tr>      <td width="15%" class="ri-bbgg"><span class="red">*</span> Title：</td>      <td width="85%" class="le">	  	<input type="text" name="title"  value="<?=$this->oneFenleiArray[0]['title']?>">	  </td>    </tr>	
    <tr>

		  <td class="ri-bbgg">分类描述：</td>

		  <td class="le">

		  	<div>

		  	  <textarea name="fenlei_description" cols="60" rows="5" id="description"><?=$this->oneFenleiArray[0]['fenlei_description']?></textarea>

		  	</div>

			

		  </td>

		</tr>
	<tr>
	  <td class="ri-bbgg"><span class="red">*</span> LOGO图片：</td>
	  <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="upload.uploadimg(this);" value="上传" /></td>
	</tr>
	<tr>
	  <td class="ri-bbgg">图片效果：</td>
	  <td class="le">
		<div id="productImages">
                              <?if ($this->oneFenleiArray[0]['logostr']){?>
				<div style="margin:10px"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->oneFenleiArray[0]['logostr']?>" /><input type="hidden" name="imgUrl[]" value="<?=$this->oneFenleiArray[0]['logostr']?>" /></div>
		              <?}?>
                </div>
		<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
	</tr>
     <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 是否公开：</td>
      <td width="85%" class="le">
	  	<select name="openflag" id="openflag">
                    <option value="1" <?if ($this->oneFenleiArray[0]['openflag']==1){?> selected <?}?>>是</option>
                    <option value="0" <?if ($this->oneFenleiArray[0]['openflag']==0){?> selected <?}?>>否</option>
                </select>
	  </td>
    </tr>
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 是否有印号：</td>
      <td width="85%" class="le">
	  	<select name="Printnumber" id="Printnumber">
                    <option value="1" <?if ($this->oneFenleiArray[0]['Printnumber']==1){?> selected <?}?>>是</option>
                    <option value="0" <?if ($this->oneFenleiArray[0]['Printnumber']==0){?> selected <?}?>>否</option>
                </select>
	  </td>
    </tr>
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red"></span> 编辑尺码：</td>
      <td width="85%" class="le">
	  	<table width="100%" id="lengthstature_table">
	  		<?php 
	  		$count_lengthstature = count($this->lengthstature);
	  		if($count_lengthstature > 0) {
	  		$len = 1;
	  		foreach ($this->lengthstature as $k=>$v) {
	  		?>
	  		<tr>
	  			<td>
	  				尺寸 :<input type="text" value="<?=$k?>" name="lengthstature_size_<?=$len?>" style="width: 30px;"/>&nbsp;
	  				长度(厘米):<input value="<?=$v['cm']['length']?>" style="width: 60px;" type="text" name="lengthstature_param_<?=$len?>[]" />&nbsp;
	  				身高(厘米):<input value="<?=$v['cm']['stature']?>" style="width: 60px;" type="text" name="lengthstature_param_<?=$len?>[]" />&nbsp;
	  				长度(英寸):<input value="<?=$v['inch']['length']?>" style="width: 60px;" type="text" name="lengthstature_param_<?=$len?>[]" />&nbsp;
	  				身高(英寸):<input value="<?=$v['inch']['stature']?>" style="width: 60px;" type="text" name="lengthstature_param_<?=$len?>[]" />&nbsp;
	  				<?php if($len == 1):?>
	  				<a href="javascript:;" onclick="addlengthstature(this);">增加</a>
	  				<?php else:?>
	  				<a href="javascript:;" onclick="removelengthstature(this);">删除</a>
	  				<?php endif;?>
	  			</td>
	  		</tr>
	  		<?php
	  		$len ++;
	  		}} else {
	  		?>
	  		<tr>
	  			<td>
	  				尺寸 :<input type="text" value="" name="lengthstature_size_1" style="width: 30px;"/>&nbsp;
	  				长度(厘米):<input value="" style="width: 60px;" type="text" name="lengthstature_param_1[]" />&nbsp;
	  				身高(厘米):<input value="" style="width: 60px;" type="text" name="lengthstature_param_1[]" />&nbsp;
	  				长度(英寸):<input value="" style="width: 60px;" type="text" name="lengthstature_param_1[]" />&nbsp;
	  				身高(英寸):<input value="" style="width: 60px;" type="text" name="lengthstature_param_1[]" />&nbsp;
	  				<a href="javascript:;" onclick="addlengthstature(this);">增加</a>
	  			</td>
	  		</tr>
	  		<?php }?>
	  	</table>
	  </td>
    </tr>    <tr>		  <td colspan="7" class="se" style="text-align:left">		  <img src="html/images/administrator/add_product_item.jpg" /> <img src="html/images/administrator/product_9.gif" /> <strong>添加配件</strong>		  </td>		</tr>		                <tr>		  <td colspan="7" class="se" style="text-align:left">  <table width="460" border="0" class="zhcx" cellpadding="0" cellspacing="0">    <tr>      <td><select name="bind1" size="18" style="width:360px;" multiple="multiple" id="bind1">                    <?foreach($this->bindProductArray as $value):?>			<option value="<?=$value['itemid']?>"><?=$value['subject']?></option>		  <?endforeach;?>        </select>      </td>      <td> &nbsp;<input type="text" size=5 class="zhcxbtn" name="price" id="price">      <br>      &nbsp;<input type="button" class="zhcxbtn" value=" &gt; " onclick="move1('add');selectAll();"/>&nbsp;        <br />        &nbsp;<input type="button" class="zhcxbtn" value=" &lt; " onclick="move1('delete');selectAll();"/> &nbsp;      </td>      <td><select name="bind2[]" size="18" style="width:360px;" multiple="multiple" id="bind2">          <?for($i=0;$i<count($this->info);$i++):?>          <option value="<?=$this->info[$i]['accessoryid']?>%%%<?=$this->info[$i]['price']?>"><?=$this->info[$i]['subject']?>%%%<?=$this->info[$i]['price']?></option>          <?endfor;?>        </select>    <script>selectAll();</script>      </td>      <td>      </td>    </tr>  </table>		  </td>		</tr>    
    <tr>
      <td colspan="2" class="se" align="center">
        <input name="button2" type="button" class="iput" value="保 存"   onclick="checkform();" />　　
        <input name="button" type="button" class="iput" value="返 回" onclick="commonEffection.confirmBack();" />
      </td>
    </tr>
  </table>
</div>
<script type="text/javascript">
var lengthstature_count = <?=$count_lengthstature?>;
function addlengthstature(obj)
{
	lengthstature_count ++;
	var add_str = '<tr><td>';
		add_str +='尺寸 :<input type="text" name="lengthstature_size_'+lengthstature_count+'" style="width: 30px;"/>&nbsp;&nbsp;';
		add_str +='长度(厘米):<input value="" style="width: 60px;" type="text" name="lengthstature_param_'+lengthstature_count+'[]" />&nbsp;&nbsp;';
		add_str +='身高(厘米):<input value="" style="width: 60px;" type="text" name="lengthstature_param_'+lengthstature_count+'[]" />&nbsp;&nbsp;';
		add_str +='长度(英寸):<input value="" style="width: 60px;" type="text" name="lengthstature_param_'+lengthstature_count+'[]" />&nbsp;&nbsp;';
		add_str +='身高(英寸):<input value="" style="width: 60px;" type="text" name="lengthstature_param_'+lengthstature_count+'[]" />&nbsp;&nbsp;';
		add_str +='<a href="javascript:;" onclick="removelengthstature(this);">删除</a>';
		add_str +='</td></tr>';
	$("#lengthstature_table").append(add_str);
	commonEffection.resetFrame('admins_frame',true);
}
function removelengthstature(obj)
{
	if(!confirm("是否确定删除此条尺码?"))
	return false;
	$($($(obj).parent("td")).parent("tr")).remove();
	commonEffection.resetFrame('admins_frame',true);
}
</script>